<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>博客新增</title>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/semantic-ui@2.4.2/dist/semantic.min.css">
    <link rel="stylesheet" href="../../static/lib/css/editormd.min.css" th:href="@{/lib/css/editormd.min.css}">
    <link rel="stylesheet" href="../../static/css/mecss.css" th:href="@{/css/mecss.css}">
</head>
<body>
<!--导航-->
<nav class="ui inverted attached segment m-padded-tb-mini m-shadow-small">
    <div class="ui container">
        <div class="ui inverted secondary stackable menu">
            <h2 class="ui teal header item">Meteor</h2>
            <a href="#" th:href="@{/admin/blogMagt}" class="active m-item item m-mobile-hide"><i class="mini home icon m-margin-biaoqian"></i>博客</a>
            <a href="#" th:href="@{/admin/types/1}" class="m-item item m-mobile-hide"><i class="mini idea icon m-margin-biaoqian"></i>分类</a>
            <a href="#"  class="m-item item m-mobile-hide"><i class="mini tags icon m-margin-biaoqian"></i>标签</a>
            <a href="#" class="m-item item m-mobile-hide"><i class="mini clone icon m-margin-biaoqian"></i>归档</a>
            <a href="#" class="m-item item m-mobile-hide"><i class="mini info icon m-margin-biaoqian"></i>关于我</a>
            <div class="right m-item m-mobile-hide menu">
                <div class="ui dropdown item">
                    <div class="text">
                        <img th:src="@{/image/touxiang.jpg}" class="ui avatar image" src="https://picsum.photos/800/600?image=1015">
                        <span th:text="${session.user.username}">Meteor</span>
                    </div>
                    <i class="ui dropdown icon">
                        <div class="menu">
                            <a href="#" class="item">注销</a>
                        </div>
                    </i>
                </div>
            </div>
        </div>
    </div>
    <a href="#" class="ui menu toggle black icon button m-top-right m-mobile-show">
        <i class="sidebar icon"></i>
    </a>
</nav>
<div class="ui attached pointing menu">
    <div class="ui container">
        <div class="right menu">
            <a href="#" th:href="@{/admin/types/input}" class="item">新增</a>
            <a href="#" th:href="@{/admin/blogMagt}" class="teal active item">博客管理</a>
        </div>
    </div>
</div>
<!--中间内容-->
<div class="m-container-small m-padded-tb-big">
    <div class="ui container">
        <form id="blog-form" action="#" th:action="@{/admin/update}" method="get" class="ui form">
            <input type="hidden" name="published">
            <div class="required field">
                <div class="ui left labeld input">
                    <div class="ui selection compact teal basic dropdown label">
                        <input type="hidden" value="原创">
                        <i class="dropdown icon" style="margin-top: -5px;"></i>
                        <div class="text" style="margin-top: 3px;">原创</div>
                        <div class="menu">
                            <div th:name="flag" class="item" data-value="原创">原创</div>
                            <div th:name="flag" class="item" data-value="转载">转载</div>
                            <div th:name="flag" class="item" data-value="翻译">翻译</div>
                        </div>
                    </div>
                    <input  type="hidden" th:value="${blog.id}" name="id">
                    <input th:value="${blog.title}" style="margin-left: -5px;" type="text" name="title" placeholder="标题">
                </div>
            </div>

            <div class="required field">
                <div id="md-content" style="z-index:1">
                        <textarea th:text="${blog.content}" placeholder="博客内容" name="content" style="display:none">
[TOC]
#### Disabled options
- TeX (Based on KaTeX);
- Emoji;
- Task lists;
- HTML tags decode;
- Flowchart and Sequence Diagram;
                        </textarea>
                </div>
            </div>
            <div class="two fields">
                <div class="required field">
                    <div class="ui left labeled action input">
                        <label class="ui compact teal basic label">分类</label>
                        <div class="ui  selection dropdown">
                            <input type="hidden" name="typeName">
                            <i class="dropdown icon"></i>
                            <div class="default text">分类</div>
                            <div class="menu">
                                <div class="item" >错误日志</div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <div class="field">
                <div class="ui left labeled input">
                    <label class="ui teal basic label">首图</label>
                    <input type="text" name="firstPicture" placeholder="首图引用地址">
                </div>
            </div>

            <div class="inline fields">
                <div class="field">
                    <div class="ui checkbox">
                        <input type="checkbox" id="recommend" checked name="recommend" class="hidden">
                        <label for="recommend">推荐</label>
                    </div>
                </div>
                <div class="field">
                    <div class="ui checkbox">
                        <input type="checkbox" id="shareStatement" name="shareStatement" class="hidden">
                        <label for="shareStatement">转载声明</label>
                    </div>
                </div>
                <div class="field">
                    <div class="ui checkbox">
                        <input type="checkbox" id="appreciation" name="appreciation" class="hidden">
                        <label for="appreciation">赞赏</label>
                    </div>
                </div>
                <div class="field">
                    <div class="ui checkbox">
                        <input type="checkbox" id="commentabled" name="commentabled" class="hidden">
                        <label for="commentabled">评论</label>
                    </div>
                </div>
            </div>

            <div class="ui error message"></div>

            <div class="ui right aligned container">
                <button type="button" class="ui button" onclick="windonw.history.go(-1)">返回</button>
                <button type="button" id="publish-btn" class="ui teal button">编辑保存</button>
            </div>
        </form>
    </div>
</div>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<!-- 底部 -->
<footer class="ui inverted attached segment m-padded-tb-massive">
    <div class="ui center aligned container">
        <div class="ui inverted divided stackable grid">
            <div class="three wide column">
                <div class="ui inverted link list">
                    <div class="item">
                        <img src="../../static/image/myvx.jpg" class="ui rounded image" alt="" style="width:100px">
                    </div>
                </div>
            </div>
            <div class="three wide column">
                <h4 class="ui inverted header m-text-thin m-text-spaced">关于学习</h4>
                <div class="ui inverted link list">
                    <a href="#" class="item">经验分享</a>
                    <a href="#" class="item">酷爱编程</a>
                    <a href="#" class="item">CodingX</a>
                </div>
            </div>
            <div class="three wide column">
                <h4 class="ui inverted header m-text-thin m-text-spaced">关于我</h4>
                <div class="ui inverted link list">
                    <a href="#" class="item">喜欢记录</a>
                    <a href="#" class="item">热爱生活</a>
                    <a href="#" class="item">热爱祖国</a>
                </div>
            </div>
            <div class="seven wide column">
                <h4 class="ui inverted header m-text-thin m-text-spaced">关于博客</h4>
                <p class="m-text-thin m-text-spaced m-opacity-mini">用来记录生活点滴、编程经验、完善自我技术、发泄情绪的心灵小屋</p>
                <p class="m-text-thin m-text-spaced m-opacity-mini">如果你也热爱编程、并且热爱祖国，可以加入我一起共同进步。</p>
            </div>
        </div>
        <div class="ui inverted section divider"></div>
        <p class="m-text-thin m-text-spaced m-opacity-tiny">Copright @ 2022 Meteor Designed By </p>
    </div>
</footer>

    <script src="https://cdn.jsdelivr.net/npm/jquery@3.2/dist/jquery.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/semantic-ui@2.4.2/dist/semantic.min.js"></script>
    <script src="../../static/lib/editormd.min.js" th:src="@{/lib/editormd.min.js}"></script>

<script>
    // 初始化Markdown编译器
    var contentEditor;
    $(function () {
        contentEditor = editormd("md-content", {
            width: "100%",
            height: 640,
            syncScrolling: "single",
            path: "/lib/lib/"
        });
    });
    $(".menu.toggle").click(function () {
        $(".m-item").toggleClass("m-mobile-hide");
    });
    $('.ui.dropdown').dropdown({
        on: 'hover',
    });

    $('#save-btn').click(function () {
       $('[name="published"]').val(false);
       $('#blog-form').submit();
    });
    $('#publish-btn').click(function () {
        $('[name="published"]').val(true);
        $('#blog-form').submit();
    });

    $('.ui.form').form({
        fields: {
            title: {
                indentifier: 'title',
                rules: [{
                    type: 'empty',
                    prompt: '标题：请输入博客标题',
                }]
            },
            content: {
                indentifier: 'content',
                rules: [{
                    type: 'empty',
                    prompt: '标题：请输入博客内容',
                }]
            },
            typeId: {
                indentifier: 'typeId',
                rules: [{
                    type: 'empty',
                    prompt: '标题：请输入博客分类',
                }]
            }
        }
    });
</script>
</body>
</html>